package BlogMybatis.blog.service.impl;

import BlogMybatis.blog.pojo.Type;
import BlogMybatis.blog.mapper.TypeMapper;
import BlogMybatis.blog.service.TypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Brandt
 * @since 2020-06-07
 */
@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements TypeService {

    @Autowired
    private TypeMapper typeMapper;
    @Override
    public Type getTypeByName(String name) {
        return typeMapper.getTypeByName(name);
    }

    @Override
    public List<Type> getIndexType() {
        return typeMapper.getIndexType();
    }

    @Override
    public Type getTypeById(Long id) {
        return typeMapper.selectById(id);
    }

    @Override
    public List<Type> getAllType() {
        return typeMapper.getAllType();
    }

    @Override
    public int saveType(Type type) {
        return typeMapper.insert(type);
    }

    @Override
    public int updateType(Type type) {
        return typeMapper.updateById(type);
    }

    @Override
    public int deleteType(Long id) {
        return typeMapper.deleteById(id);
    }


}
